home *** CD-ROM | disk | FTP | other *** search
/ Champak 138 / Volume 138 Aug 19 2011 - Damaged.iso / Games / shadez.swf / scripts / Local / Game / Thing / CVehicleTankM1A1.as < prev    next >
Encoding:
Text File  |  2011-08-19  |  8.2 KB  |  317 lines

  1. package Local.Game.Thing
  2. {
  3.    import Local.Game.World.*;
  4.    import Local.Game.World.Map.*;
  5.    import Local.Game.World.Map.Cell.*;
  6.    import Local.Math.*;
  7.    import STC9.System.*;
  8.    import flash.display.*;
  9.    import flash.events.*;
  10.    import flash.geom.*;
  11.    
  12.    public class CVehicleTankM1A1 extends CVehicle
  13.    {
  14.        
  15.       
  16.       private var mPrimaryWeapon:CWeaponGunM1A1;
  17.       
  18.       private var _Command:String = "proceed";
  19.       
  20.       public function CVehicleTankM1A1(param1:CPosition)
  21.       {
  22.          if(true)
  23.          {
  24.             _Command = "proceed";
  25.             if(true)
  26.             {
  27.                super(param1);
  28.                if(true)
  29.                {
  30.                   mType = "tankm1a1";
  31.                   if(true)
  32.                   {
  33.                      Process = Process_Normal;
  34.                      if(true)
  35.                      {
  36.                         mMaxLife = mLife = 300;
  37.                         if(true)
  38.                         {
  39.                            mMaxSpeed = (7 + Math.random() * 1.5) * mSpriteScalar;
  40.                            if(true)
  41.                            {
  42.                               mSpeed = 0;
  43.                               if(true)
  44.                               {
  45.                                  mAcceleration = 0.1;
  46.                                  if(true)
  47.                                  {
  48.                                     SetTargetting(1000 - Math.random() * 300,false,FILTER_GroundTargets);
  49.                                  }
  50.                                  AddAnimation("stand",TankM1A1,"AddSprite_Black",true);
  51.                               }
  52.                               SetCollisionBySprite(mAnimation[0]);
  53.                            }
  54.                            CompileNodes();
  55.                         }
  56.                         mWeaponDelta = new CPosition();
  57.                      }
  58.                      mOrientation = 1;
  59.                   }
  60.                   AddThing(mPrimaryWeapon = new CWeaponGunM1A1());
  61.                }
  62.                SetState("GOTO");
  63.             }
  64.             IncrementBuild();
  65.          }
  66.       }
  67.       
  68.       public static function get mCost() : int
  69.       {
  70.          return 10000;
  71.       }
  72.       
  73.       public function get mIconIndex() : int
  74.       {
  75.          return 2;
  76.       }
  77.       
  78.       public function State_MOUSEOVER_Enter() : void
  79.       {
  80.       }
  81.       
  82.       public function get mCommandDrop() : Boolean
  83.       {
  84.          return false;
  85.       }
  86.       
  87.       public function get mCommand() : String
  88.       {
  89.          return _Command;
  90.       }
  91.       
  92.       public function set mCommand(param1:String) : void
  93.       {
  94.          _Command = param1;
  95.          if(_Command == "proceed")
  96.          {
  97.             mSpeed = 0;
  98.          }
  99.       }
  100.       
  101.       public function State_GOTO_Exit() : void
  102.       {
  103.       }
  104.       
  105.       public function State_MOUSEOVER_Exit() : void
  106.       {
  107.       }
  108.       
  109.       public function State_GOTO() : void
  110.       {
  111.          if(true)
  112.          {
  113.             if(mNode.hasTraction)
  114.             {
  115.                if(true)
  116.                {
  117.                   var _loc1_:*;
  118.                   mCurrentTarget = _loc1_ = GetTarget();
  119.                   if(_loc1_ != null)
  120.                   {
  121.                      if(true)
  122.                      {
  123.                         SetState("TARGET");
  124.                         if(true)
  125.                         {
  126.                            addr40:
  127.                            if(mCommand == "proceed")
  128.                            {
  129.                            }
  130.                            if(mDisposed)
  131.                            {
  132.                               ┬º┬ºgoto(addr56);
  133.                            }
  134.                            else
  135.                            {
  136.                               return;
  137.                            }
  138.                         }
  139.                         VehicleMove();
  140.                      }
  141.                      mCollide.Update();
  142.                   }
  143.                }
  144.             }
  145.             ┬º┬ºgoto(addr40);
  146.          }
  147.          addr56:
  148.       }
  149.       
  150.       public function State_WAIT() : void
  151.       {
  152.          var _loc1_:*;
  153.          mCurrentTarget = _loc1_ = GetTarget();
  154.          if(_loc1_ != null)
  155.          {
  156.             SetState("TARGET");
  157.             return;
  158.          }
  159.          if(mStateCount < 0)
  160.          {
  161.             SetState("GOTO");
  162.          }
  163.       }
  164.       
  165.       public function State_MOUSEOVER() : void
  166.       {
  167.          if(mStateCount < 0 && !mMouseOver)
  168.          {
  169.             SetState(mReturnStateID);
  170.          }
  171.       }
  172.       
  173.       public function State_TARGET_Exit() : void
  174.       {
  175.          mPrimaryWeapon.mFire = false;
  176.          mPrimaryWeapon.mCurrentTarget = null;
  177.       }
  178.       
  179.       public function get mLongName() : String
  180.       {
  181.          return "M1A1 Abrams Battle tank";
  182.       }
  183.       
  184.       public function get mCommandProceed() : Boolean
  185.       {
  186.          return true;
  187.       }
  188.       
  189.       public function State_TARGET() : void
  190.       {
  191.          if(true)
  192.          {
  193.             if(!ValidTarget(mCurrentTarget))
  194.             {
  195.                if(true)
  196.                {
  197.                   mStateCount = SECONDS;
  198.                   if(true)
  199.                   {
  200.                      SetState("WAIT");
  201.                      if(true)
  202.                      {
  203.                         return;
  204.                      }
  205.                      addr41:
  206.                      ┬º┬ºpush(mPrimaryWeapon);
  207.                      if(true)
  208.                      {
  209.                         ┬º┬ºpop().mFire = true;
  210.                         addr46:
  211.                         ┬º┬ºpush(mPrimaryWeapon);
  212.                      }
  213.                      if(┬º┬ºpop().mFired)
  214.                      {
  215.                         addr57:
  216.                         mPrimaryWeapon.mFired = false;
  217.                         addr59:
  218.                         return;
  219.                         addr56:
  220.                      }
  221.                      ┬º┬ºgoto(addr59);
  222.                   }
  223.                   ┬º┬ºgoto(addr46);
  224.                }
  225.                ┬º┬ºgoto(addr56);
  226.             }
  227.             else
  228.             {
  229.                ┬º┬ºpush(mPrimaryWeapon);
  230.                if(true)
  231.                {
  232.                   if(┬º┬ºpop().SetTarget(mCurrentTarget))
  233.                   {
  234.                      ┬º┬ºgoto(addr41);
  235.                   }
  236.                   ┬º┬ºgoto(addr46);
  237.                }
  238.             }
  239.          }
  240.          ┬º┬ºgoto(addr57);
  241.       }
  242.       
  243.       public function get mShortDesc() : String
  244.       {
  245.          return "The M1 Abrams is produced in the US. Equipped with a 105mm rifled tank gun, it will rip vehicles apart and reduce troops to shreds. Good against ground units!";
  246.       }
  247.       
  248.       public function State_GOTO_Enter() : void
  249.       {
  250.          if(true)
  251.          {
  252.             mSpeed = 0;
  253.          }
  254.       }
  255.       
  256.       override public function Draw() : void
  257.       {
  258.          var _loc1_:Matrix = null;
  259.          super.Draw();
  260.          _loc1_ = GetOrientationMatrix();
  261.          DrawSprite(_loc1_);
  262.          mPrimaryWeapon.Draw();
  263.       }
  264.       
  265.       public function State_WAIT_Exit() : void
  266.       {
  267.       }
  268.       
  269.       public function Process_Normal() : void
  270.       {
  271.          if(Process_State != null)
  272.          {
  273.             Process_State();
  274.          }
  275.          if(mDisposed)
  276.          {
  277.             return;
  278.          }
  279.          mPrimaryWeapon.Process();
  280.          mPrimaryWeapon.mPosition.Copy(OrientatePoint(mSprite.mObjects["maingun"].mPosition.clone(),mPosition));
  281.          if(mDead)
  282.          {
  283.             DispatchDispose();
  284.          }
  285.       }
  286.       
  287.       public function get mCommandHalt() : Boolean
  288.       {
  289.          return true;
  290.       }
  291.       
  292.       override public function get mSmallPrize() : int
  293.       {
  294.          return mCost;
  295.       }
  296.       
  297.       override public function get mPrize() : int
  298.       {
  299.          return mCost * 2;
  300.       }
  301.       
  302.       public function State_TARGET_Enter() : void
  303.       {
  304.       }
  305.       
  306.       public function get mCommandTakeControl() : Boolean
  307.       {
  308.          return false;
  309.       }
  310.       
  311.       public function State_WAIT_Enter() : void
  312.       {
  313.          mSpeed = 0;
  314.       }
  315.    }
  316. }
  317.